package oop;

/**
 * Created with IntelliJ IDEA.
 * ClassName: ValueTransferTest
 * Package: oop
 * Description:
 * User: fzykd
 *
 * @Author: LQH
 * Date: 2023-11-19
 * Time: 15:33
 */

//方法的值传递机制 实参 传递 给 形参
public class ValueTransferTest {
    public static void main(String[] args) {

        ValueTransferTest val = new ValueTransferTest();

        //1.对于基本数据类型的遍历
        int m = 10;

        val.method1(m);

        System.out.println(m);//10

        Person p = new Person();
        p.age = 10;
        val.method2(p);
        System.out.println(p.age);

    }

    public void method1(int m){
        m++;
    }

    public void method2(Person p){
        p.age++;
    }

}

class Person{
    int age;
}
